import axios from "axios";

export async function getGoods() {
  var resp = await axios.get("/api/pets/Goods.do", {
    params: {
      method: "getAll",
    },
  });
  console.log(resp);
  return resp.data;
}

export async function GoodsAdd(Goods) {
  var resp = await axios.get("/api/pets/Goods.do", {
    params: {
      method: "GoodsAdd",
      goodsName: Goods.goodsName,
      goodsType: Goods.goodsType,
      goodsMaterial: Goods.goodsMaterial,
      goodsDogtype: Goods.goodsDogtype,
      goodsExdogtype: Goods.goodsExdogtype,
      goodsPackage: Goods.goodsPackage,
      goodsFlavor: Goods.goodsFlavor,
      goodsFunction: Goods.goodsFunction,
      goodsPlace: Goods.goodsPlace,
      goodsDate: Goods.goodsDate,
      goodsLasting: Goods.goodsLasting,
      goodsFeature: Goods.goodsFeature,
      goodsPrice: Goods.goodsPrice,
    },
  });
  console.log(resp);
  return resp.data;
}

export async function deleteById(goodsId) {
  var resp = await axios.get("/api/pets/Goods.do", {
    params: {
      method: "delete",
      goodsId,
    },
  });
  return resp.data;
}

export async function updateGoods(Goods,goodsId) {
  var resp = await axios.get("/api/pets/Goods.do", {
    params: {
      method: "updateGoods",
      goodsId,
      goodsName: Goods.goodsName,
      goodsType: Goods.goodsType,
      goodsMaterial: Goods.goodsMaterial,
      goodsDogtype: Goods.goodsDogtype,
      goodsExdogtype: Goods.goodsExdogtype,
      goodsPackage: Goods.goodsPackage,
      goodsFlavor: Goods.goodsFlavor,
      goodsFunction: Goods.goodsFunction,
      goodsPlace: Goods.goodsPlace,
      goodsDate: Goods.goodsDate,
      goodsLasting: Goods.goodsLasting,
      goodsFeature: Goods.goodsFeature,
      goodsPrice: Goods.goodsPrice,
    },
  });
  console.log("++++++++++");
  console.log(goodsId);
  return resp.data;
}

export async function selectById(goodsId) {
    console.log("========");
  var resp = await axios.get("/api/pets/Goods.do", {
    params: {
      method: "selectById",
      goodsId,
    },
  });
  return resp.data;
}
